import React, { Component } from 'react'

export default class RenderProps extends Component {
    render() {
        return (
            <div>
                RenderProps
                {/* <A>
                    Hello
                    <B/>
                </A> */}


                <A render={(count)=><B count={count}/>} />
            </div>
        )
    }
}

class A extends Component {
    state = {
        count: 1
    }
    render() {
        console.log(this.props)
        return (
            <div>
                -------- A 
                <br />
                {/* -------- {this.props.children} */}
                {this.props.render(this.state.count)}
            </div>
        )
    }
}

class B extends Component {
    render() {
        console.log('b render',this.props)
        return (
            <div>
                ---------------- B {this.props.count}
            </div>
        )
    }
}
